<%//@ include file="../include/eproAuthorization.jsp"%>
<%@ page  
	errorPage="../include/eproErrorPage.jsp"
	contentType="text/html; charset=windows-874" 
	import=		"com.epro.standard.frontend.util.FileInfoUtil,
            com.epro.standard.frontend.util.ShowData,
            com.softplus.carrefour.hd.CFHDSystem,
            com.softplus.carrefour.hd.bltier.admin.CountryManage,
            com.softplus.carrefour.hd.bltier.admin.UserLevelManage,
            com.softplus.carrefour.hd.bltier.entity.Country,
            com.softplus.carrefour.hd.bltier.entity.UserLevel,
            java.util.Vector"
%>
<%
  // com.softplus.carrefour.hd.bltier.manage.*
%>
<HTML xmlns:epro>
<%@ taglib uri="/WEB-INF/HeadTag.tld" prefix="head"%>
<%@ taglib uri="/WEB-INF/ToolbarTag.tld" prefix="toolbar"%>
<%@ taglib uri="/WEB-INF/TextfieldTag.tld" prefix="textfield"%>
<%@ taglib uri="/WEB-INF/TextareaTag.tld" prefix="textarea"%>
<%@ taglib uri="/WEB-INF/ListboxTag.tld" prefix="listbox"%>
<%@ taglib uri="/WEB-INF/LovButtonTag.tld" prefix="lovbutton"%>
<%@ taglib uri="/WEB-INF/CheckboxTag.tld" prefix="CheckboxTag"%>

<head:Head 
	author="MAX"
	title="User's Office Hour(s) Setup : Add New"
	import="toolbar,textfield,textarea,listbox,button,checkbox"
	jsFile="../script/imgProp.js,../script/Alert.js,../script/checkValidData.js,../script/lov.js"
	styleFile ="../theme/defaultTheme.css"></head:Head>
<%
    String textfieldWidth 	      = "280";
    String listBoxWidth           = "280" ;
    String lovWidth               = "50";
   	String lovDescWidth   	      = "230";

    ShowData         showData 	  = new ShowData();

    CountryManage cm  = (CountryManage)CFHDSystem.getControlClass("COUNTRY");
    Vector  cv        = cm.getAllCountry() ;
    String[] listboxCountryData   = new String[cv.size()+1] ;
    String[] listboxCountryLabel  = new String[cv.size()+1] ;
    listboxCountryData[0]   = "" ;
    listboxCountryLabel[0]  = "" ;
    for(int i=1; i<cv.size()+1; i++)
    {
      Country cEntity = (Country)cv.elementAt(i-1) ;
      listboxCountryData[i]   = cEntity.getCountryId() ;
      listboxCountryLabel[i]  = cEntity.getCountryName() ;
    }

    UserLevel       ul            = new UserLevel() ;
    String[] listboxUserLevelData = {""} ; // {"", ul.LEVEL_1_COUNTRY_HELPDESK, ul.LEVEL_2_COUNTRY_APPLICATION_TEAM_BACK_OFFICE, ul.LEVEL_2_AMS_ZONE_ASIA, ul.LEVEL_3_AMS_BANGKOK, ul.PRODUCTION_STAFF} ;
    String[] listboxUserLevelLabel= {""} ; // {"", ul.getLevelName(ul.LEVEL_1_COUNTRY_HELPDESK), ul.getLevelName(ul.LEVEL_2_COUNTRY_APPLICATION_TEAM_BACK_OFFICE), ul.getLevelName(ul.LEVEL_2_AMS_ZONE_ASIA), ul.getLevelName(ul.LEVEL_3_AMS_BANGKOK), ul.getLevelName(ul.PRODUCTION_STAFF)} ;
    
  	String listboxHours_Data[]    = {"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23",};
    String listboxHours_Label[]   = {"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23",};
    String listboxMinutes_Data[]  = {"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"};
    String listboxMinutes_Label[] = {"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"};
%>
<%//@ include file="../include/eproPopupJsp.jsp"%>

<SCRIPT language="javascript">

    function submitForm()
  	{
			if(	isNull(frm.countryID,"Country")&&
          isNull(frm.userLevel,"User Level") )
			{
        if (showOConfirmDialog("Confirm","Do you want to save?","OK","Cancel") == 1)
        {
          frm.submit() ;
          parent.dialogArguments.location.reload() ;
          parent.window.close() ;
          <%//@ include file="../include/eproSaveFormSubmit.jsp"%>
        }
      }
    }
    
    function clearForm()
    {
      frm.reset() ;
      removeUserLevelList() ;
    }
    
    function confirmBack()
    {
      if (showOConfirmDialog("Confirm","Do you want to back?","OK","Cancel") == 1)
      {
        parent.window.close() ;
      }
    }

    function setListUserLevel()
    {
      removeUserLevelList() ;
      frmUser.location.href = "SELECT_USER_LEVEL.jsp?countryID=" + frm.countryID.value ;
    }
    
    function removeUserLevelList()
    {
      while(frm.userLevel.options.length > 0)
        frm.userLevel.options.remove(0) ;
    }
    
</SCRIPT>
<%@ include file="../include/toolbarHint.jsp"%>
<BODY>
<DIV style="width:100%;height:90%;margin:5px" class="modalBg">
<%//@ include file="../include/eproPopupToolbar.jsp"%>
   <FORM name="frm" action="../servlet/com.softplus.carrefour.hd.frontend.servlet.administration.CFHDAD04" method="post" onsubmit="submitForm();return false;">
			<INPUT type="hidden" name="action" value="insert">
			<TABLE align="center" width="80%">
      
				<TR>
          <TD colspan="2">
            <img alt="<%=saveHint%>" src="../images/icon/toolbar/nSave.gif" onmouseover="this.src='../images/icon/toolbar/oSave.gif'" onmouseout="this.src='../images/icon/toolbar/nSave.gif'" style="cursor:hand" onclick="submitForm();">
            <img alt="<%=clearHint%>" src="../images/icon/toolbar/nClear.gif" onmouseover="this.src='../images/icon/toolbar/oClear.gif'" onmouseout="this.src='../images/icon/toolbar/nClear.gif'" style="cursor:hand" onclick="clearForm();">
            <img alt="<%=exitHint%>" src="../images/icon/toolbar/nExit.gif" onmouseover="this.src='../images/icon/toolbar/oExit.gif'" onmouseout="this.src='../images/icon/toolbar/nExit.gif'" style="cursor:hand" onclick="confirmBack();">
          </TD>
					<TD  align="right"><FONT class="titleFont" color="red">*required field</FONT></TD>
				</TR>
        
			  <TR>
			    <TD width="40%" align="right" valign="top" class="titleFont"><FONT class="titleFont" color="red">*</FONT>Country : </TD>
          <TD width="5"></TD>
          <TD class="dataDetailPK"><listbox:listbox name="countryID" data="<%=listboxCountryData%>" label="<%=listboxCountryLabel%>" width="<%=listBoxWidth%>" onchange="setListUserLevel();"/></TD>
		    </TR>
          
        <TR>
          <TD align="right" valign="top" class="titleFont"><FONT class="titleFont" color="red">*</FONT>User Level : </TD>
          <TD width="5"></TD>
          <TD class="dataDetailPK"><listbox:listbox name="userLevel" data="<%=listboxUserLevelData%>" label="<%=listboxUserLevelLabel%>" width="<%=listBoxWidth%>"/></TD>
        </TR>
        
        <TR>
          <TD colspan="3" align="center">
            <FIELDSET class="titleFont" style="text-align: right;width: 430px;margin-left: 58px;"><LEGEND class="borderFontHeadOfWorkingTime">Office Hour(s)</LEGEND>
              <TABLE  width="100%" cellspacing="0" cellpadding="3">
                <TR>
                  <TD width="30%" align="right" valign="top" class="titleFont">From :</TD>
                  <TD width="5"></TD>
                  <TD class="dataDetailPK">
                    <listbox:listbox name="StartTimeHours" data="<%=listboxHours_Data%>" label="<%=listboxHours_Label%>" selectedIndex="1" width="50"></listbox:listbox>
                    &nbsp;  :
                    <listbox:listbox name="StartTimeMinutes" data="<%=listboxMinutes_Data%>" label="<%=listboxMinutes_Label%>" selectedIndex="1" width="50"/>
                  </TD>
                  <TD>&nbsp;</TD>
                </TR>          
                <TR>
                  <TD width="30%" align="right" valign="top" class="titleFont">To :</TD>
                  <TD width="5"></TD>
                  <TD class="dataDetailPK">
                    <listbox:listbox name="EndTimeHours" data="<%=listboxHours_Data%>" label="<%=listboxHours_Label%>" selectedIndex="1" width="50"/>
                    &nbsp;  :
                    <listbox:listbox name="EndTimeMinutes" data="<%=listboxMinutes_Data%>" label="<%=listboxMinutes_Label%>" selectedIndex="1" width="50"/>
                  </TD>
                  <TD>&nbsp;</TD>
                </TR>
              </TABLE>
            </FIELDSET>
          </TD>
        </TR>
              
        <TR>
          <TD colspan="3" align="center">
            <FIELDSET class="titleFont" style="text-align: right;width: 430px;margin-left: 58px;"><LEGEND class="borderFontHeadOfWorkingTime">Working Day</LEGEND>
              <TABLE  width="100%" cellspacing="0" cellpadding="3">
                <TR>
                  <TD width="30%" align="right" valign="top" class="titleFont"></TD>
                  <TD width="5"></TD>
                  <TD class="dataDetailPK">
                    <CheckboxTag:checkbox name="workingDay" label="Sunday" value="0" check="true"/><BR>
                    <CheckboxTag:checkbox name="workingDay" label="Monday" value="1" check="true"/><BR>
                    <CheckboxTag:checkbox name="workingDay" label="Tuesday" value="2" check="true"/><BR>
                    <CheckboxTag:checkbox name="workingDay" label="Wednesday" value="3" check="true"/><BR>
                    <CheckboxTag:checkbox name="workingDay" label="Thursday" value="4" check="true"/><BR>
                    <CheckboxTag:checkbox name="workingDay" label="Friday" value="5" check="true"/><BR>
                    <CheckboxTag:checkbox name="workingDay" label="Saturday" value="6" check="true"/><BR>
                  </TD>
                  <TD>&nbsp;</TD>
                </TR>
              </TABLE>
            </FIELDSET>
          </TD>
        </TR>
        
      </TABLE>
   </FORM>
</DIV>
<iframe name="frmUser" width="0" height="0"></iframe>
</BODY>
</HTML>
